using System.Collections.Generic;
using UnityEngine;

[CreateAssetMenu(fileName = "Condition20-检测被攻击的棋子后一格没有棋子", menuName = "Skill/Condition/Condition20-检测被攻击的棋子后一格没有棋子", order = 20)]
public class Condition20 : ConditionBase
{
    public override bool Evaluate(Pair pair,GameEvent e)
    {
        if (e is not AttackChessEvent attackChessEvent) return false;

        Vector2Int position;
        if (attackChessEvent.BeAttackedChess.GetChessSide() == ChessSide.Player2)
        {
            position = attackChessEvent.BeAttackedChess.ChessDetail.Position + Vector2Int.up;
        }
        else
        {
            position = attackChessEvent.BeAttackedChess.ChessDetail.Position + Vector2Int.up;
        }

        return !ChessBoardMgr.GetInstance().ChessboardDict[position].chessDate;
    }
}